﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using PloobsEngine.Publishers;
using PloobsEngine.Physics.XJigLib;

namespace PloobsEngine.Behaviors
{
    public class TorqueBehavior : IBehavior
    {

        #region IBehavior Members

        ApplyTorqueAction ata;

        public TorqueBehavior(JigLibXObject obj)
        {
            ata = new ApplyTorqueAction(obj, new Vector3(0, 100, 0));
         }
        public void PerformBehavior(string state, object data)
        {
            ata.Action();
        
        }

        #endregion

        private ISubject _sub = new ConcreteSubject();
        #region ISubject Members
        public int ObserverNumber()
        {
            return _sub.ObserverNumber();
        }

        public void Attach(IObserver obs)
        {
            _sub.Attach(obs);
        }

        public void Dettach(IObserver obs)
        {
            _sub.Dettach(obs);
        }

        public void DettachAll()
        {
            _sub.DettachAll();
        }

        public void Notify(object obj)
        {
            _sub.Notify(obj);
        }

        #endregion

        #region IBehavior Members


        public string BehaviorName
        {
            get { return NAME; }
        }
        public const String NAME = "TorqueBehavior";
   
        #endregion

        #region IBehavior Members


        private IList<IAction> actionsList = new List<IAction>();
        public IList<IAction> Actions
        {
            get { return actionsList; }
        }

        #endregion



        #region IBehavior Members


        public void Release()
        {

        }

        #endregion
    }
}
